import { Injectable } from '@angular/core'

import { ObservableStore } from '@shared/classes/ObservableStoreClass'
import { MerchantFull } from '@shared/interfaces/merchant'
import { deepCopy } from '@delon/util'

@Injectable()
export class MerchantStoreService extends ObservableStore<MerchantFull> {
  constructor() {
    super(new MerchantFull())
  }

  updateValue(merchant: MerchantFull): void {
    const value = deepCopy(this.value)
    Object.assign(value, merchant)
    this.setValue(value)
  }

  reset(): void {
    this.setValue(new MerchantFull())
  }
}
